WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
loader.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21#include <dlfcn.h>
22#include <string>
23#include <map>
24#include <memory>
25#include "yaml-cpp/yaml.h"
26
27namespace wolf
28{
29class Loader
30{
31 protected:
32 int flags_;
33 std::map<std::string, void*> name_resources_;
34
35 public:
36 Loader(int flags = RTLD_LAZY);
37 ~Loader();
38
39 void load(std::string _libname_with_so);
40 void loadPlugin(std::string _plugin);
41
42 void close(std::string _libname_with_so);
43 void closePlugin(std::string _plugin);
44
45 void* isLoaded(std::string _libname_with_so) const;
46 void* isLoadedPlugin(std::string _plugin) const;
47
48 void searchAndLoadPlugins(const YAML::Node& _node);
49 static std::set<std::string> searchPlugins(const YAML::Node& _node, std::list<YAML::Node>& _visited_nodes);
50 static std::set<std::string> searchFieldsRecursive(const YAML::Node& _node,
51 std::list<YAML::Node>& _visited_nodes,
52 const std::string& field);
53 size_t size() const;
54};
55typedef std::shared_ptr<Loader> LoaderPtr;
56
57} // namespace wolf
Definition: loader.h:30
size_t size() const
Definition: loader.cpp:116
void loadPlugin(std::string _plugin)
Definition: loader.cpp:63
void load(std::string _libname_with_so)
Definition: loader.cpp:46
void searchAndLoadPlugins(const YAML::Node &_node)
Definition: loader.cpp:121
void close(std::string _libname_with_so)
Definition: loader.cpp:68
void closePlugin(std::string _plugin)
Definition: loader.cpp:89
std::map< std::string, void * > name_resources_
Definition: loader.h:33
static std::set< std::string > searchFieldsRecursive(const YAML::Node &_node, std::list< YAML::Node > &_visited_nodes, const std::string &field)
Definition: loader.cpp:133
void * isLoaded(std::string _libname_with_so) const
Definition: loader.cpp:94
void * isLoadedPlugin(std::string _plugin) const
Definition: loader.cpp:111
int flags_
Definition: loader.h:32
~Loader()
Definition: loader.cpp:38
Loader(int flags=RTLD_LAZY)
Definition: loader.cpp:31
static std::set< std::string > searchPlugins(const YAML::Node &_node, std::list< YAML::Node > &_visited_nodes)
Definition: loader.cpp:128
Definition: capture_base.h:23
std::shared_ptr< Loader > LoaderPtr
Definition: loader.h:55